﻿using System.IO;
using System.Text;
using System;
using System.Linq;
using UtilLib;

namespace ProtocolTool
{
    partial class Program
    {
        //NameClient
        public static readonly string Filepath_NameClient = @"NameClient.txt";

        /// <summary>
        /// 生成 客户端文本
        /// </summary>
        private static void ProtocolConverterNameClient()
        {
            Show("ProtocolConverterNameClient");
            var sb = new StringBuilder();

            foreach (var nn in DictClass.Values)
            {
                if (nn.ClassType != 0)
                {
                    continue;
                }
                if (nn.Name.IsNullOrEmpty())
                {
                    continue;
                }
                if (nn.Name.StartsWith("G2C") || nn.Name.StartsWith("L2C") || nn.Name.StartsWith("ALL") || nn.Name.StartsWith("All"))
                {
                    sb.AppendLine(nn.Name);
                }
            }
            FileStream fs = new FileStream(PathCurrent + Filepath_NameClient, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
            sw.Write(sb.ToString());
            sw.Close();
            Show("输出文件：" + Filepath_NameClient);
        }

    }
}